<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<link href="/static/css/default.css" rel="stylesheet" type="text/css">
<link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id = 'link'>
</head>

<body style="overflow:hidden; padding:10px;">
	<form>
    <table class="formtable" style="width:580px;">
    
    <tbody>
    
    	<tr>
        <td class="tlabel">教师姓名</td>
        <td>
		<input type="text" class="forminput inputstyle1" id="teachername" value="{$info.teachername}">
		</td>
        </tr>
        
        <tr>
        <td class="tlabel">手机</td>
        <td>
		<input type="text" class="forminput inputstyle1" id="phone" value="{$info.phone}">
		</td>
        </tr>
        
        <tr>
        <td class="tlabel">性别</td>
        <td>
		 <select type="text" id="sex"  class="select"  v-model="sex">
						     <option value="">
								 请选择
								</option>
                                <option v-for="item in list" :value='item'>
								 {{item}}
								</option>
                            </select>
		</td>
        </tr>
        
        <tr>        
        <td class="tlabel">身份证号码</td>
        <td>
		<input type="text" id="idcard" class="forminput inputstyle1" value="{$info.idcard}">
		</td>
        </tr>
        
        <tr>
        <td class="tlabel">毕业院校</td>
        <td><input type="text" id="overschool"  class="forminput inputstyle1" value="{$info.overschool}"></td>
        </tr>
        
        <tr>
        <td class="tlabel">参加工作时间</td>
        <td><input type="text" id="jointime" class="forminput inputstyle1"  autocomplete="off"  onfocus="WdatePicker()"  value="{$info.jointime}"></td>
        </tr>
        
      
        <tr>
        <td class="tlabel">离职时间</td>
        <td><input type="text" id="outtime"  class="forminput inputstyle1"  autocomplete="off" onfocus="WdatePicker()" value="{$info.outtime}"></td>
        </tr>
                
         <tr>
        <td class="tlabel">紧急联系方式</td>
        <td><input type="text" id="otherphone"  class="forminput inputstyle1" value="{$info.otherphone}"></td>
        </tr>
                
        
        
    </tbody>
    
    </table>
    
    <div class="formbtn">
    <input type="button" value="保存"  class="btnsave">
    <input type="button" value="取消"  class="btncancel">
    </div>
    <input type="hidden" id="id" value="{$info.id}" />
</form>


</body>
	<script type="text/javascript" src="/static/js/jquery.js"></script>
    <script type="text/javascript" src="/static/js/common.js"></script>
	<script type="text/javascript" src="/static/js/vue2.js"></script>
    <script src="/static/js/layer/layer.js"></script>
    <script src="/static/My97DatePicker/WdatePicker.js"></script>
<script>
var sex ="{$info.sex}";
    var menu = new Vue({
        el: '#sex',
        data: {
			sex:sex,
            list: ["男","女"]
        },
        methods: {
            getdata: function () {
                var _self = this;//保存this的指向
            
            }

        },
        created: function () {  //初始化事件里边去调用查询方法
            this.getdata();
        }
    });
	
	$(function(){
		$(".btnsave").click(function(){
			 var id = $("#id").val();
			var teachername = $("#teachername").val();
			var phone = $("#phone").val();
			var sex = $("#sex").val();
			var idcard = $("#idcard").val();
			var overschool = $("#overschool").val();
			var jointime = $("#jointime").val();
			var outtime = $("#outtime").val();
			var otherphone = $("#otherphone").val();

            if(teachername==""){
				layer.msg("请输入教师姓名");
				return;
			}else if(phone==""){
				layer.msg("请输入手机号码");
				return;
			}else if(sex==""){
				layer.msg("请选择性别");
				return;
			}
			

			$.post("/Index/Teacher/Add", { "id": id, "phone":phone, "teachername": teachername, "sex": sex, "idcard": idcard,
			"overschool": overschool,"jointime":jointime,"outtime":outtime,"otherphone":otherphone }, function (data) {
				if (data.status == 200) {
					var index = parent.layer.getFrameIndex(window.name);
					window.parent.iframe.contentWindow.location.reload(true);
					console.log(window.parent.iframe);
					parent.layer.close(index);
				}else{
					layer.msg(data.message);
				}
			});
		});
		$(".btncancel").click(function(){
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		});
	});
   

</script>
</html>
